﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace DispatcherHost
{
	class Program
	{
		static ServiceHost _serviceHost;

		static void Main(string[] args)
		{
			Console.WriteLine("Start hosting");
			AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
			using (_serviceHost = new ServiceHost(typeof(DispatcherLibrary.Dispatcher)))
			{
				_serviceHost.Open();
				Console.WriteLine("The service is ready");
				Console.ReadLine();
			}
		}

		static void CurrentDomain_ProcessExit(object sender, EventArgs e)
		{
			_serviceHost.Close();
		}
	}
}
